import { sequelize } from '../../db';
import { DataTypes, Model } from 'sequelize';
class Coupon extends Model { }

Coupon.init({
    UserId: DataTypes.INTEGER,
    name: DataTypes.STRING,
    price: DataTypes.INTEGER,
    lowPrice: DataTypes.INTEGER,
    StoreItemId: DataTypes.INTEGER,
    ratio: {
        type: DataTypes.INTEGER,
        validate: { min: 0, max: 1 }
    },
    from: DataTypes.STRING,
    fromBy: DataTypes.INTEGER,
    verification: DataTypes.INTEGER,
    code: DataTypes.STRING,
    state: {
        type: DataTypes.BOOLEAN,
        defaultValue: 0
    }
}, {
    sequelize,
    paranoid: true
});

export default Coupon